return;
if (this._curRequestBegin && this._curRequestEnd){
- let callFlags = Gio.DBusCallFlags.NO_AUTO_START;
- if (forceReload)
- callFlags = Gio.DBusCallFlags.NONE;
this._dbusProxy.GetEventsRemote(this._curRequestBegin.getTime() / 1000,
this._curRequestEnd.getTime() / 1000,
forceReload,
Lang.bind(this, this._onEventsReceived),
- callFlags);
+ Gio.DBusCallFlags.NONE);
}
},
- requestRange: function(begin, end, forceReload) {
- if (forceReload || !(_datesEqual(begin, this._lastRequestBegin) && _datesEqual(end, this._lastRequestEnd))) {
+ requestRange: function(begin, end) {
+ if (!(_datesEqual(begin, this._lastRequestBegin) && _datesEqual(end, this._lastRequestEnd))) {
this.isLoading = true;
this._lastRequestBegin = begin;
this._lastRequestEnd = end;
this._curRequestBegin = begin;
this._curRequestEnd = end;
- this._loadEvents(forceReload);
+ this._loadEvents(false);
}
},
setEventSource: function(eventSource) {
this._eventSource = eventSource;
this._eventSource.connect('changed', Lang.bind(this, function() {
- this._update(false);
+ this._update();
}));
- this._update(true);
+ this._update();
},
// Sets the calendar to show a specific date
- setDate: function(date, forceReload) {
- if (!_sameDay(date, this._selectedDate)) {
- this._selectedDate = date;
- this._update(forceReload);
- this.emit('selected-date-changed', new Date(this._selectedDate));
- } else {
- if (forceReload)
- this._update(forceReload);
- }
+ setDate: function(date) {
+ if (_sameDay(date, this._selectedDate))
+ return;
+
+ this._selectedDate = date;
+ this._update();
+ this.emit('selected-date-changed', new Date(this._selectedDate));
},
_buildHeader: function() {
this._backButton.grab_key_focus();
- this.setDate(newDate, false);
+ this.setDate(newDate);
},
_onNextMonthButtonClicked: function() {
this._forwardButton.grab_key_focus();
- this.setDate(newDate, false);
+ this.setDate(newDate);
},
_onSettingsChange: function() {
this._useWeekdate = this._settings.get_boolean(SHOW_WEEKDATE_KEY);
this._buildHeader();
- this._update(false);
+ this._update();
},
- _update: function(forceReload) {
+ _update: function() {
let now = new Date();
if (_sameYear(this._selectedDate, now))
this._shouldDateGrabFocus = true;
let newlySelectedDate = new Date(iterStr);
- this.setDate(newlySelectedDate, false);
+ this.setDate(newlySelectedDate);
this._shouldDateGrabFocus = false;
}));
}
// Signal to the event source that we are interested in events
// only from this date range
- this._eventSource.requestRange(beginDate, iter, forceReload);
+ this._eventSource.requestRange(beginDate, iter);
}
});
this.menu.connect('open-state-changed', Lang.bind(this, function(menu, isOpen) {
if (isOpen) {
let now = new Date();
- /* Passing true to setDate() forces events to be reloaded. We
- * want this behavior, because
- *
- * o It will cause activation of the calendar server which is
- * useful if it has crashed
- *
- * o It will cause the calendar server to reload events which
- * is useful if dynamic updates are not supported or not
- * properly working
- *
- * Since this only happens when the menu is opened, the cost
- * isn't very big.
- */
- this._calendar.setDate(now, true);
- // No need to update this._eventList as ::selected-date-changed
- // signal will fire
+ this._calendar.setDate(now);
}
}));